package org.goldenport.g3.sample

import org.goldenport.g3._
import org.goldenport.g3.messages._
import org.goldenport.g3.messages.entity._

/**
 * @since   Aug. 19, 2010
 * @version Aug. 31, 2010
 * @author  ASAMI, Tomoharu
 **/
class EntityInsert extends G3Application with UseRecord {
  entityspace('myds, new BookEntityDriver(""))

  val cmd = MsgAnd(
    Insert(BookEntitySpace.KIND_PUBLISHER,
           Record('id -> 10, 'name -> "ABC Publication")),
    Insert(BookEntitySpace.KIND_AUTHOR,
           Record('id -> 700, 'name -> "Yamada Taro")),
    Insert(BookEntitySpace.KIND_BOOK,
           Record('id -> 5, 'name -> "My book",
                  'author -> 700,
                  'publisher -> 10))
/*
    Insert(BookEntitySpace.KIND_BOOK,
           Record('id -> 6, 'name -> "My notebook",
                  'author_name -> "Yamada Taro",
                  'publisher_name -> "ABC Publication"))
*/
  )
  start(cmd) invoke("myds")
}
